package crud.client.factory.form.multiple.value;

import java.io.Serializable;
import java.util.List;

import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.rpc.IsSerializable;

import crud.client.data.Colonne;
import crud.client.data.DataView;
import crud.client.factory.form.ComboBoxFactory;
import crud.client.service.ServiceLocator;

public class LibelleComboBoxFactory extends ComboBoxFactory implements Serializable, IsSerializable
{
	

	public void setValues(String[] values)
	{
		dataViewMap.clear();
		
		for (int cp = 0; cp <= values.length - 1; cp++)
		{
			DataView dataView = new DataView(values[cp].split("[=]")[0], values[cp].split("[=]")[0], values[cp].split("[=]")[1]);
			dataViewMap.put(dataView.getKey(), dataView);
		}
	}

	@Override
	public void populateList(Colonne colonne, AsyncCallback<List<DataView>> callback)
	{
		ServiceLocator.getServiceBase().getEmptyDataViewListCallback(callback);
	}

}
